﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using EmaMetadata;
using System.IO;

namespace MetadataTest
{
    [TestClass]
    public class UnitTest2
    {
        [TestMethod]
        public void JustinsTest()
        {
           //Loads the xml file to be referenced
            EmaBatch b = Factory.LoadBatchFromString(Resource1.Just_Cause_2);

            // File should have one product
            Assert.AreEqual(b.Products.Count, 1);

            // Okay, let's examine this product
            EmaProduct p = b.Products[0];

            // Verify that its identities loaded correctly
            Assert.AreEqual(p.GetIdentity("org.gs1", "GTIN-14").Value, "00014633098891");
            Assert.AreEqual(p.GetIdentity("com.eedar", "EEDAR").Value, "219511");
            Assert.AreEqual(p.GetIdentity("com.microsoft", "GUID").Value, "{0002E101-0000-0000-C000-000000000046}");

            // Verify that the complete title is correct
            Assert.AreEqual(p.GetTitle("org.entmerch", "Complete").Value, "Just Cause 2 Platinum Edition");

            // Verify a couple hand selected facts
            Assert.AreEqual(p.GetRegion("US").ReleaseDate, new DateTime(2010, 03, 23));
        }
    }
}
